//注册验证部分
function register(){

		var name=$('#username').val();
		var pass=$('#password1').val();
		var re_pass=$('#password2').val();
		var email=$('#mailadres').val();
		$.get("ec.php", {name: name, email: email, pass : pass,re_pass:re_pass,ac: "register",act:"new",ac:"register"},function(data){
				if(data=='success')
			{
				$('form').fadeOut("slow"); 
				warning('Message','注册成功!,系统给你的邮箱发送了一封激活邮件，请点击其中的链接激活您的帐户。');
			}
			else
				warning('Message','出错啦：'+data);
		}); 
}
function login(){

}

function checkUserName(){
	var name=$('#username').val();
	var unLen = name.replace(/[^\x00-\xff]/g, "**").length;
	if(unLen < 5 || unLen > 15) {
		var str = (unLen < 5 ? '用户名小于5个字符' : '用户名超过 15 个字符');
		warning("checkusername",str);
		return false;
	}
		var filter=/^\s*[.A-Za-z0-9_-]{6,15}\s*$/; 
	if(!filter.test(name))
    {
		warning("checkusername","用户名格式不正确");
		return false;
    }
	warning("checkusername","OK");
	return true;
}
function checkPass(){
	pass=$('#password1').val();
	re_pass=$('#password2').val();
	if	(!(pass==re_pass)){
		warning("checkpass","两次输入密码不相等，请重新输入。");
		return false;
	}
	var unLen = pass.replace(/[^\x00-\xff]/g, "**").length;
	if(unLen < 6 || unLen > 32) {
		var str = (unLen < 6 ? '密码小于6个字符' : '密码超过 32 个字符');
		warning("checkpass",str);
		return false;
	}
	warning("checkpass","OK");
	return true;
}
function checkEmail(){
	var email=$('#mailadres').val();
	var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,4}$/;
    if(!myreg.test(email))
    {
		warning("checkemail","邮箱格式不正确");
		return false;
    }
	warning("checkemail","OK");
	return true;
}
function warning(obj,msg)
{
	$("#"+obj).empty(); 
	$("#"+obj).append(msg); 
}